<template >
<div>
  <el-container class="index-container">
   
    <el-header class="index-header" style="height: 80px;">
      <!-- 头部部分 -->
      <el-row>
        <el-col :span="3">
          <div class="grid-content bg-purple" style="padding:10px">
            <img
              v-if="this.currentUser.currentDepartmentName2 == '极易网'"
              class="logo"
              src="../assets/jiYiWang.png"
              alt
            />
            <img
              v-else-if="this.currentUser.currentDepartmentName2 == '冠全网'"
              style="margin:0"
              class="logo"
              src="../assets/xinYuanWang.png"
              alt
            />
            <img
              v-else-if="this.currentUser.currentDepartmentName2.indexOf('速') != -1"
              class="logo"
              src="../assets/white.jpg"
              alt
            />
            <img
              v-else-if="this.currentUser.currentDepartmentName2.indexOf('北京一分') != -1"
              class="logo"
              src="../assets/北京一分.png"
              alt
            />
            <img
              v-else-if="this.currentUser.currentDepartmentName2.indexOf('上海三分') != -1"
              class="logo"
              src="../assets/NewSuSan.png"
              alt
            />
            <img
              v-else-if="this.currentUser.currentDepartmentName2.indexOf('上海一分') != -1"
              class="logo"
              src="../assets/logo2x.png"
              alt
            />
            <img v-else src="../assets/logo.png" alt />
          </div>
        </el-col>
        <el-col :span="15">
          <div class="grid-content bg-p urple-light title">
            <!-- <span><img src="../assets/horn.png" alt=""> &nbsp;恭喜，赵大河本周的业绩取得第一名，特此公告。</span> -->
            <!-- <span><img src="../assets/horn.png" alt=""> &nbsp;恭喜，XXX本周的业绩取得第一名，特此公告。</span> -->
            <!-- <el-button @click="websocketToLogin">我没收到</el-button> -->
            <!-- <el-button @click="websocketToLogin2">我收到了</el-button> -->
            <div class="marquee">
              <div class="marquee_box">
                <ul class="marquee_list" :class="{marquee_top:animate}">
                  <li v-for="(item,index) in announcement" :key="index">{{item}}</li>
                </ul>
              </div>
            </div>
          </div>
        </el-col>
        <el-col :span="3">
          <el-badge :value="len?len:null" class="item rep">
            <el-button size="small" @click="$router.push({ path: `/Remarks`})" >需要回复</el-button>
          </el-badge>
        </el-col>
        <el-col :span="3">
          <div class="grid-content bg-purple" id="bg-purple">
            <!-- <el-button type="danger" icon="el-icon-delete" circle></el-button> -->
            <el-button
              size="small"
              style="background-color:#c73e3a;color:#fff"
              class="xinXiKG"
              @click="closeJieShou"
              v-show="this.ShowxinXiKG"
            >已开启信息接收</el-button>
            <el-button
              size="small"
              style="background-color:#008C5E;color:#fff"
              class="xinXiKG"
              @click="OpenJieShou"
              v-show="!this.ShowxinXiKG"
            >已关闭信息接收</el-button>
            <el-button
              size="small"
              style="background-color:#c73e3a;color:#fff"
              @click="signOut"
            >退出登录</el-button>
          </div>
        </el-col>
      </el-row>
    </el-header>
    <!-- 主体区域 -->
    <el-container>
      <!-- 侧边栏 -->
      <el-aside width="185px" class="index-aside">
        <!-- 用户信息显示区域 -->
        <div class="userinfo">
          <p>{{this.currentName}},欢迎您！</p>
          <div class="switch">
            <span class="qiehuan">切换</span>
            <el-select v-model="changeUser" id="guwen" placeholder disabled>
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
            <button class="huanyuanbth" @click="getUnread">还原</button>
          </div>
        </div>
        <!-- 无分层导航栏 -->
        <el-menu
          router
          :default-active="activeRouter"
          class="el-menu-vertical-demo"
          active-text-color="#ca4a47"
          @open="handleOpen"
          @close="handleClose"
        >
          <el-submenu index="1" v-if="showList.cusManagement">
            <template slot="title">
              <i class="el-icon-s-custom"></i>客户管理
            </template>
            <el-menu-item-group>
              <el-menu-item index="/myCustomer" v-if="showList.showCusForGuWen">
                <i class="el-icon-user"></i>
                我的客户{{yslCount}}
              </el-menu-item>
              <el-menu-item index="/customerList" v-if="showList.showCustomerList">
                <i class="el-icon-user"></i>客户列表
              </el-menu-item>
              <el-menu-item index="/redistribution" v-if="showList.showCusForGuWen">
                <i class="el-icon-refresh-right"></i>
                再分配客户{{zfpCount}}
              </el-menu-item>
              <el-menu-item index="/teamCus" v-if="showList.showTeamCus">
                <i class="el-icon-user-solid"></i>团队客户
              </el-menu-item>
              <el-menu-item index="/SendOutCustomers" v-if="showList.showCustomerList">
                <i class="el-icon-share"></i>外发客户
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="2" v-if="showList.HeGuiManagement">
            <template slot="title">
              <i class="el-icon-service"></i>合规管理
            </template>
            <el-menu-item-group>
              <el-menu-item index="/CallRecords" v-if="showList.showTongHua">
                <i class="el-icon-phone-outline"></i>通话管理
              </el-menu-item>
              <el-menu-item index="/ReturnVisitCustomers" v-if="showList.showReViCus">
                <i class="el-icon-help"></i>回访客户
              </el-menu-item>
              <el-menu-item index="/Unsigned" v-if="showList.showReViCus">
                <i class="el-icon-help"></i>上门未签约
              </el-menu-item>
              <el-menu-item index="/ServiceEvaluation" v-if="showList.showReViCus">
                <i class="el-icon-help"></i>回访统计
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-menu-item index="/FinExamine" v-if="showList.showFinExamine">
            <i class="el-icon-document-copy"></i>业绩管理
          </el-menu-item>
          <el-menu-item index="/Leaderboard" v-if="showList.showLeaderboard">
            <i class="el-icon-s-data"></i>业绩排行榜
          </el-menu-item>
          <el-menu-item index="/OnSiteCustomer" v-if="showList.showXingZheng">
            <i class="el-icon-sell"></i>上门客户
          </el-menu-item>
          <!-- <el-menu-item index="ReturnVisitCustomers"  v-if="showList.showReViCus"><i class="el-icon-help"></i>回访客户</el-menu-item> -->
          <el-menu-item index="/FinRechargeRecord" v-if="showList.showFinExamine">
            <i class="el-icon-coin"></i>充值记录
          </el-menu-item>
          <el-submenu index="3" v-if="showList.showTongji">
            <template slot="title">
              <i class="el-icon-data-line"></i>统计分析
            </template>
            <el-menu-item-group>
              <el-menu-item index="/dataStatistics">
                <i class="el-icon-data-analysis"></i>数据统计
              </el-menu-item>

              <!-- <el-menu-item index="/ResEfficiency">
                <i class="el-icon-watch"></i>数据处理效率
              </el-menu-item> -->
              <el-menu-item index="/newResEfficiency">
                <i class="el-icon-watch"></i>新数据处理效率
              </el-menu-item>
              <el-menu-item index="/BankAnalysis">
                <i class="el-icon-pie-chart"></i>进件银行分析
              </el-menu-item>
              <el-menu-item index="/PerformanceAnalysis">
                <i class="el-icon-s-finance"></i>业绩进度分析
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="4" v-if="showList.showCaiWu">
            <template slot="title">
              <i class="el-icon-notebook-1"></i>财务管理
            </template>
            <el-menu-item-group>
              <el-menu-item index="/examine">
                <i class="el-icon-edit-outline"></i>在审件管理
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="5" v-if="showList.showYunYing">
            <template slot="title">
              <i class="el-icon-shopping-bag-2"></i>运营管理
            </template>
            <el-menu-item-group>
              <el-menu-item index="/SourceStatistics">
                <i class="el-icon-receiving"></i>来源管理
              </el-menu-item>
              <el-menu-item index="/SupplyConfiguration">
                <i class="el-icon-s-operation"></i>供量配置
              </el-menu-item>
              <el-menu-item index="/rechargeRecord">
                <i class="el-icon-edit"></i>充值记录
              </el-menu-item>
              <el-menu-item index="/rechargeDeplete">
                <i class="el-icon-toilet-paper"></i>充值消耗
              </el-menu-item>
              <el-menu-item index="/PromotionAnalysis">
                <i class="el-icon-truck"></i>申请跑量分析
              </el-menu-item>
              <el-menu-item index="/toBReport">
                <i class="el-icon-s-order"></i>对公数据报表
              </el-menu-item>
              <el-menu-item index="/popularizeAnalysis">
                <i class="el-icon-document"></i>推广数据分析
              </el-menu-item>
              <el-menu-item index="/PublicDaataReport">
                <i class="el-icon-view"></i>新版对公报表
              </el-menu-item>
              <el-menu-item index="/SendOutManagement">
                <i class="el-icon-s-promotion"></i>外发管理
              </el-menu-item>
              <!-- <el-menu-item index="dataAnalysis"><i class="el-icon-pie-chart"></i>数据分析</el-menu-item> -->
            </el-menu-item-group>
          </el-submenu>
          <el-menu-item index="/department" v-if="showList.showDepartmnet" style="bumenshow">
            <i class="el-icon-s-shop"></i>部门管理
          </el-menu-item>
          <el-menu-item index="/WorkLog" v-if="showList.showQuDao" style="bumenshow">
            <i class="el-icon-notebook-1"></i>工作日志
          </el-menu-item>
          <el-submenu index="6" v-if="showList.showLog">
            <template slot="title">
              <i class="el-icon-s-order"></i>日志管理
            </template>
            <el-menu-item-group>
              <el-menu-item index="/MyLog" v-if="showList.showLog">
                <i class="el-icon-tickets"></i>我的日志
              </el-menu-item>
              <el-menu-item index="/TeamLog" v-if="showList.showTeamLog">
                <i class="el-icon-document-copy"></i>团队日志
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="7" v-if="showList.ShowBlacklist">
            <template slot="title">
              <i class="el-icon-lock"></i>系统安全
            </template>
            <el-menu-item-group>
              <el-menu-item index="/Blacklist">
                <i class="el-icon-warning"></i>黑名单
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-menu-item index="/userSetting">
            <i class="el-icon-user-solid"></i>个人中心
          </el-menu-item>
          <el-submenu index="8" v-if="showList.showTeamCus">
            <template slot="title">
              <i class="el-icon-s-order"></i>更多
            </template>
            <el-menu-item-group v-if="showList.showcj">
              <el-menu-item index="/lotterySetting">
                <i class="el-icon-sugar"></i>抽奖设置
              </el-menu-item>
            </el-menu-item-group>
            <el-menu-item-group>
              <el-menu-item index="/lotteryRes">
                <i class="el-icon-sugar"></i>抽奖页面
              </el-menu-item>
            </el-menu-item-group>
            <!-- <el-menu-item-group>
              <el-menu-item index="/announcement">
                <i class="el-icon-sugar"></i>公告设置
              </el-menu-item>
            </el-menu-item-group>-->
          </el-submenu>
        </el-menu>
      </el-aside>
      <keep-alive>
        <el-main class="index-main" id="index-main">
          <!-- tabs -->
          <my-tabs />
          <!-- 增加router-view  keep-alive设置是否需要缓存-->
          <keep-alive
            exclude="Leaderboard,dataStatistics,rechargeRecord,rechargeDeplete,SupplyConfiguration,MyTabs,BankAnalysis,PromotionAnalysis,PromotionAnalysis"
          >
            <router-view></router-view>
          </keep-alive>
        </el-main>
      </keep-alive>
       
    </el-container>
    
  </el-container>
</div>
</template>

<script>
import { log } from "util";
import { mapMutations } from "vuex";
import myTabs from "./MyTabs";
// 导入时间戳
import moment from "moment";
import { websocketObj } from "../@/websocket/websocket";
import myfun from "../@/strArray"
import { PerformanceDate } from "../@/performent";
export default {
  name: "index",
  data() {
    return {
      len: 0,
      drawer:true,
      wx: "",
      wxbz: "",
      currentUser: {
        currentName: "",
        currentId: "",
        currentLevel: "",
        currentPhone: "",
        currentIsNeedData: "",
        currentDepartmentId: "",
        currentDepartmentName2: "",
        position: "",
      },
      announcement: [
        "测试公告：恭喜，璎珞本周的业绩取得第一名，特此公告。",
        "测试公告：恭喜，任颖本周的业绩取得第二名，特此公告。",
        "测试公告：恭喜，xxx本周的业绩取得第三名，特此公告。",
      ],
      animate: false,
      currentName: "", //当前登录用户的姓名
      ShowxinXiKG: "", //信息开关按钮显隐
      //tabs存值判重
      title: "",
      name: "",
      //动态改变默认router
      activeRouter: "/myCustomer",
      options: [
        { value: "选项1", label: "小明" },
        { value: "选项5", label: "小冉" },
      ],
      changeUser: "",
      bumenshow: "",
      showList: {
        showCustomerList: true,
        showYunYing: true,
        showCusForGuWen: true,
        showDepartmnet: true,
        showLeaderboard: true,
        showTongji: true,
        showCaiWu: true,
        cusManagement: true, //客户管理一级tab
        showFinExamine: false,
        showTeamCus: true,
        showLog: true,
        showTeamLog: true,
        showXingZheng: false,
        showTongHua: true, //通话记录
        HeGuiManagement: false, //仅供合规使用回访客户页面
        showReViCus: false, //仅供合规使用回访客户页面
        ShowBlacklist: false, //黑名单
        showQuDao: false, //黑名单
        showcj: false,
      },
      interval: "", //请求回访客户的计时器
      notifyPromise: Promise.resolve(), //通知，解决element-ui，同时调用notify时，通知重叠的问题
    };
  },
  methods: {
    handleClose1(done) {
        this.$confirm('确认关闭？')
          .then(_ => {
            done();
          })
          .catch(_ => {});
      },
    showMarquee: function () {
      this.animate = true;

      setTimeout(() => {
        this.announcement.push(this.announcement[0]);

        this.announcement.shift();

        this.animate = false;
      }, 500);
    },
    //  getConfigResult (res) {
    //   // 接收回调函数返回数据的方法
    //   console.log(res)
    // },
    // websocketToLogin () {
    //   // 【agentData：发送的参数；this.getConfigResult：回调方法】
    //   this.socketApi.sendSock(1566, this.getConfigResult)
    // },
    // websocketToLogin2 () {
    //   // 【agentData：发送的参数；this.getConfigResult：回调方法】
    //   this.socketApi.sendSock("关闭服务", this.getConfigResult)
    // },
    ...mapMutations(["Add_Tab"]),
    handleOpen(key, keyPath) {
      // console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      // console.log(key, keyPath);
    },
    //关闭数据开关
    closeJieShou() {
      this.$axios
        .get(
          `/spider/user/openData?userId=${this.currentUser.currentid}&bool=false`
        )
        .then((res) => {
          if (res.data.messageModel.code == 0) {
            this.$message.success("数据开关已关闭，当前状态不接收新数据");
            this.ShowxinXiKG = false;
            window.sessionStorage.setItem("isNeedData", false);
          } else {
            this.$message.error(res.data.messageModel.messageText);
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },
    //打开数据开关
    OpenJieShou() {
      this.$axios
        .get(
          `/spider/user/openData?userId=${this.currentUser.currentid}&bool=true`
        )
        .then((res) => {
          if (res.data.messageModel.code == 0) {
            this.$message.success(
              "数据开关已开启，请及时查看并处理新数据(#^.^#)"
            );
            this.ShowxinXiKG = true;
            window.sessionStorage.setItem("isNeedData", true);
          } else {
            this.$message.error(res.data.messageModel.messageText);
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },
    //退出登录
    signOut() {
      this.$confirm("此操作将退出登录状态, 是否继续?", "退出登录", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({ type: "success", message: "您成功已退出登录" });
          window.sessionStorage.clear();
          //清除计时器
          if (this.interval) {
            clearInterval(this.interval);
          }
          this.$store.commit("clearEditableTabs");
          this.$router.push("login");
        })
        .catch(() => {
          this.$message({ type: "info", message: "已取消退出登录" });
        });
    },
    addTab(name, title) {
      let newTabName = ++this.tabIndex + "";
      this.editableTabs.push({
        title: title,
        name: name,
      });
      // this.editableTabsValue = newTabName;
      this.editableTabsValue = name;
      this.$router.push(`${this.editableTabsValue}`);
      this.handleClick();
    },
    //tabs
    removeTab(targetName) {
      let tabs = this.editableTabs;
      let activeName = this.editableTabsValue;

      if (activeName === targetName) {
        tabs.forEach((tab, index) => {
          if (tab.name === targetName) {
            let nextTab = tabs[index + 1] || tabs[index - 1];
            if (nextTab) {
              activeName = nextTab.name;
            }
          }
        });
      }
      this.editableTabsValue = activeName;
      this.editableTabs = tabs.filter((tab) => tab.name !== targetName);
      // 判断是否全部移除完，标签页全部移除则返回首页
      if (this.editableTabs.length !== 0) {
        this.$router.push({ path: `${this.editableTabsValue}` });
      } else {
        this.$router.push({ path: "/" });
      }
    },
    // 切换便签页
    handleClick(tab, event) {
      this.$router.push(`${this.editableTabsValue}`);
    },
    // 添加tabs的方法
    changeActive(val, value) {
      localStorage.setItem("activeRouter", val);
      this.activeRouter = localStorage.getItem("activeRouter");
    },
    // 获取未处理的数据数量
    getUnread() {
      this.$axios
        .get(
          `/spider/customer/getCusCount?userId=${this.currentUser.currentid}`
        )
        .then((res) => {
          // console.log(res);
          if (res.data.messageModel.code != 0) {
            this.$message.error(res.data.messageModel.messageText);
          } else {
            this.$store.commit("getUnread", res.data.dataModel);
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },
    //定时查询待回访客户并弹窗提示
    AskDaiHuiFang() {
      var beginTime = moment(new Date()).format("YYYY-MM-DD HH:mm:ss");
      var endTime = new Date();
      endTime = moment(endTime.getTime() + 1000 * 60 * 30).format(
        "YYYY-MM-DD HH:mm:ss"
      ); //后推半小时
      this.$axios
        .get(
          `/spider/customer/getReturnVisitCustomer?userId=${this.currentUser.currentid}&beginTime=${beginTime}&endTime=${endTime}`
        )
        .then((res) => {
          if (res.data.dataModel.length != 0) {
            for (let i = 0; i < res.data.dataModel.length; i++) {
              let returnVisitTime = moment(
                res.data.dataModel[i].returnVisitTime
              ).format("YYYY-MM-DD HH:mm:ss");
              let that = this;
              this.notifyPromise = this.notifyPromise
                .then(this.$nextTick)
                .then(() => {
                  this.$notify({
                    title: "回访提醒",
                    dangerouslyUseHTMLString: true,
                    message:
                      '<span>客户<a href="javascript:void(0);" onclick="goToEdit()" style="color:#B2001F">' +
                      res.data.dataModel[i].name +
                      '</a>, 回访时间<i style="color:#B2001F">' +
                      returnVisitTime +
                      "</i></span><br><span>请及时跟进~</span>",
                    duration: 0,
                    onClick: function () {
                      that.goToEdit(
                        res.data.dataModel[i].zaiFenPei,
                        res.data.dataModel[i].id
                      );
                    },
                  });
                });
            }
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },
    //弹窗跳转编辑页的方法
    goToEdit(zaiFenPei, id) {
      //获取当前路由
      // let path = this.$route.path
      let CusId = id;
      // 编程式导航
      this.$router.push({
        path: "/myCusEdit",
        query: { CusId: CusId, addatbn: zaiFenPei },
      });
      window.sessionStorage.setItem("CusId", CusId);
      let NewPage = "_empty" + "?time=" + new Date().getTime() / 500; //解决刷新子页面但不闪动的问题
      this.$router.push(NewPage);
      this.$router.go(-1);
    },
  },
  created() {
    // 广告轮播
    setInterval(this.showMarquee, 2000);

    this.currentUser.currentName = window.sessionStorage.getItem("name");
    this.currentUser.currentid = window.sessionStorage.getItem("id");
    this.currentUser.currentDepartmentId = window.sessionStorage.getItem(
      "departmentId"
    );
    this.currentUser.currentLevel = window.sessionStorage.getItem("userLevel");
    this.currentUser.currentIsNeedData = window.sessionStorage.getItem(
      "isNeedData"
    );
    this.currentUser.currentDepartmentName2 = window.sessionStorage.getItem(
      "departmentName2"
    );
    this.currentUser.currentPhone = window.sessionStorage.getItem("phone");
    this.currentUser.position = window.sessionStorage.getItem("position");
    //清除计时器
    if (this.interval) {
      clearInterval(this.interval);
    } else {
      var that = this;
      this.interval = setInterval(function () {
        var time = new Date();
        time.setHours(new Date().getHours());
        time = `${time.getMinutes()}`;
        if (time == "00" || time == "30") {
          that.AskDaiHuiFang(); //请求回访客户
        }
        // //判断顾问是否被取消登录权限
        // that.$axios
        // .get(`/spider/user/getUserById?id=${this.currentUser.currentid}`)
        // .then(res => {
        //   // console.log(res.data.dataModel.prohibitLogin);
        //   if (res.data.dataModel.prohibitLogin == false) {
        //     that.$message({  type: 'info',  message: '您已被限制登录'  });
        //     window.sessionStorage.clear();
        //     //清除计时器
        //     if (this.interval) {
        //       clearInterval(this.interval)
        //     }
        //     that.$store.commit('clearEditableTabs');
        //     that.$router.push("login");
        //   }
        // })
        // .catch(error => {
        //   console.log(error);
        // });
      }, 60000);
    }
    if (this.currentUser.currentIsNeedData == "true") {
      this.ShowxinXiKG = true;
    } else {
      this.ShowxinXiKG = false;
    }
    if (this.currentUser.currentLevel == 0) {
      //管理员
      for (let key in this.showList) {
        this.showList[key] = true;
      }
      this.showList.showcj = true;
      this.showList.showFinExamine = false;
      this.showList.showQuDao = false;
    }
    if (this.currentUser.currentLevel == 10) {
      //运营
      this.showList.showCusForGuWen = false;
      this.showList.showTeamCus = false;
      this.showList.showLeaderboard = false;
      this.showList.showLog = false;
      this.showList.showTeamLog = false;
      this.showList.showXingZheng = false;
      this.showList.showDepartmnet = true;
      this.showList.showTongHua = false;
      this.showList.ShowBlacklist = true;
      // if (this.currentUser.currentPhone == 13268210642 || this.currentUser.currentPhone == 13544215057) {
      //   this.showList.showDepartmnet = true;
      // }else{
      //   this.showList.showDepartmnet = false;
      // }
      this.$router.push("customerList");
      // this.$router.go(0)
    }
    if (
      this.currentUser.currentLevel != 0 &&
      this.currentUser.currentLevel < 5
    ) {
      //管理层
      this.showList.showCustomerList = false;
      this.showList.showYunYing = false;
      this.showList.showXingZheng = false;
      this.showList.showLog = true; //暂时仅限管理员可见
      this.showList.showTeamLog = true; //暂时仅限管理员可见
      this.showList.showTongHua = true;
      this.showList.HeGuiManagement = true;
      this.showList.showReViCus = true;
    }
    if (this.currentUser.currentLevel == 5) {
      //顾问
      this.showList.showCustomerList = false;
      this.showList.showDepartmnet = false;
      this.showList.showLeaderboard = false;
      this.showList.showYunYing = false;
      this.showList.showTongji = false;
      this.showList.showTeamCus = false;
      this.showList.showXingZheng = false;
      this.showList.showLog = true; //顾问亦可见
      this.showList.HeGuiManagement = true; //合规模块
      this.showList.showReViCus = true; //合规回访客户
      this.showList.showTeamLog = false; //暂时仅限管理员、业务端领导可见
      this.showList.showTongHua = false; //通话记录  临时禁止！！！
      this.showList.ShowBlacklist = false;
    }
    if (this.currentUser.currentLevel == 12) {
      //人事
      alert("当前登陆用户所属部门为HR，请联系管理员获取相关权限");
      this.$router.push("login");
    }
    if (this.currentUser.currentLevel == 16) {
      //行政 showXingZheng
      for (let key in this.showList) {
        this.showList[key] = false;
      }
      this.showList.showXingZheng = true;
      this.$router.push("OnSiteCustomer");
    }
    if (this.currentUser.currentLevel == 17) {
      //合规
      for (let key in this.showList) {
        this.showList[key] = false;
      }
      this.showList.HeGuiManagement = true; //合规模块
      this.showList.showTongHua = true; //通话记录 和 回访客户
      this.showList.showReViCus = true; //通话记录 和 回访客户
      this.$router.push("CallRecords");
    }
    if (this.currentUser.currentLevel == 11) {
      //财务
      for (let key in this.showList) {
        this.showList[key] = false;
      }
      this.showList.showFinExamine = true;
      this.showList.showLeaderboard = true;
      // this.showList.showLog = false;
      this.$router.push("FinExamine");
    } else {
      this.showList.showFinExamine = false;
    }
    if (
      this.currentUser.currentLevel == 51 ||
      this.currentUser.currentLevel == 52
    ) {
      //进件助理
      for (let key in this.showList) {
        this.showList[key] = false;
      }
      this.currentName = window.sessionStorage.getItem("name");
      this.showList.showQuDao = true;
      // 编程式导航
      this.$router.push("WorkLog");
    }
    if (this.currentUser.currentLevel) {
      if (window.sessionStorage.getItem("prohibitLogin") == "true") {
        this.currentName = window.sessionStorage.getItem("name");
        //获取未处理数据数量
        this.getUnread();
      } else if (window.sessionStorage.getItem("prohibitLogin") == "false") {
        this.$message.warning("您已被禁止登陆");
        this.$router.push("login");
      } else {
        this.$message.warning("请先进行登录操作！");
        this.$router.push("login");
      }
    } else {
      this.$message.warning("请先进行登录操作！");
      this.$router.push("login");
    }

    this.Add_Tab({
      name: this.$route.meta.name,
      path: this.$route.path,
    });
    // console.log(this.$store.state.common.zfpCount);
    // 获取公告
    this.wx = websocketObj(
      "gg",
      (res) => {
        window.console.log(res);
        window.console.log(myfun(res));
        this.announcement = res.split(";");
        this.announcement.pop();
      },
      ""
    );
    this.wxbz = websocketObj(
      "bz",
      (res) => {
        this.len =JSON.parse(res).length
        if(this.len>0) this.$notify.info({
          title: '备注需回复',
          message: '您有上级备注信息，请及时回复'
        });
        window.sessionStorage.setItem("bz",res)
      },""
    );
    //测试关闭
    // setTimeout(()=> {
    //   mywx.close()
    // },10000)
  },
  components: {
    myTabs,
  },
  computed: {
    zfpCount() {
      return this.$store.state.common.zfpCount;
    },
    yslCount() {
      return this.$store.state.common.yslCount;
    },
  },
  beforeDestroy() {
    this.wx.close();
    this.wxbz.close();
  },
  beforeDestroy() {
    this.$axios.post(
      "http://localhost:3747/api/v1/indexperformance/addrecording",
      {
        data: PerformanceDate(window.performance),
        url: window.location.href,
      }
    );
  },
  activated() {},
};
</script>

<style lang='scss'>
//公告
.marquee {
  width: 400px;
  height: 30px;
  align-items: center;
  color: #3a3a3a;
  background-color: white;
  display: flex;
  box-sizing: border-box;
  margin: 10px;
  overflow: hidden;

  .marquee_box {
    margin: 10px;
    width: 100%;
    height: 30px;
    position: relative;
    .marquee_list {
      position: absolute;
      margin: 0;
      // top: -16px;
      li {
        line-height: 30px;
        height: 30px;
        list-style: none;
        list-style-image: url("../assets/horn.png");
      }
    }
    .marquee_top {
      transition: all 0.5s;
      margin-top: -30px;
    }
  }
}
.index-container .index-header {
  margin-top: 10px !important;
  line-height: 30px !important;
}

.item {
  margin-top: 10px;
  margin-right: 40px;
}
.el-input__icon {
  line-height: 20px;
}
.index-aside {
  height: 105%; //临时解决推广数据分析页面的闪屏问题
  // height: 100%;
}
.el-menu {
  border-right: 0;
}
.el-menu-item,
.el-submenu__title {
  border-bottom: 1px solid #ececec;
}
.index-container {
  // height: 100%;
  .el-menu-vertical-demo {
    .el-menu-item-group__title {
      padding: 0;
    }
    ul {
      overflow: hidden;
      li ul li {
        font-size: 12px;
        background-color: rgba(246, 246, 246, 1);
      }
    }
  }
  .index-header {
    line-height: 80px;
    #bg-purple {
      height: 80px;
      line-height: 40px;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    .logo {
      box-sizing: content-box;
      margin-top: 16px;
      width: 108px;
      height: 52px;
      // margin-left: 34px;
      margin-left: 12px;
    }
    .title {
      color: #5990f7;
      font-size: 12px;
      font-weight: 500;
    }
  }
  .index-aside {
    border-top: 1px solid #ef4553;
    .userinfo {
      height: 110px;
      padding-left: 15px;
      border-bottom: 1px solid #ececec;
      p {
        margin-top: 40px;
      }
      .switch {
        // /deep/.el-input__prefix, .el-input__suffix {
        //   top: 10px!important;
        // }
        .qiehuan {
          margin-right: 10px;
        }
        .huanyuanbth {
          height: 20px;
          width: 45px;
          background-color: #c73e3a;
          margin-top: 2px;
          vertical-align: top;
          margin-left: 10px;
          border: 1px solid grey;
          border-radius: 3px;
          color: #f7f7f7;
        }
      }
      .el-button {
        width: 50px;
        height: 20px;
        margin-top: 2px;
        margin-left: 10px;
        vertical-align: top;
      }
    }
    #guwen {
      width: 60px;
      height: 20px;
      padding-left: 0;
    }
  }
  .index-main {
    background-color: #f7f7f7;
    padding: 10px;
    // overflow: hidden;  //2020.1.2注释
    // overflow:scroll;  //2020.1.2修改！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！
    //全局去除table的hover效果
    tr:hover > td {
      background-color: initial !important;
    }
    tr.current-row > td {
      background-color: initial !important;
    }
    .el-tabs {
      background-color: #fff;
      border-bottom: 1px solid rgb(58, 138, 199);
      width: 100%;
      .el-tabs__item {
        // border: 1px solid rgb(58, 138, 199);
        // border-bottom: none;
        background-color: rgb(194, 217, 228);
      }
      .el-tabs__header {
        margin: 0;
      }
    }
  }
}
//回访提示框的宽度
.right.el-notification {
  width: 340px;
}
.rep {
  margin-top: 22px;
  margin-right: 40px;
}
</style>
